﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Tum.CollabXT
{
    /// <summary>
    /// Base interface for workflows. This interface connects static process model parts <see cref="IStaticProcessElement"/> and dynamic parts <see cref="IDynamicProcessElement"/>.
    /// </summary>
    public interface IWorkflow : IStaticProcessElement
    {
        /// <summary>
        /// Gets the activities assigned to the workflow.
        /// </summary>
        IWorkflowActivity[] Activities
        {
            get;
        }

        /// <summary>
        /// Gets the transitions assigned to the workflow.
        /// </summary>
        IWorkflowTransition[] Transitions
        {
            get;
        }

        /// <summary>
        /// Gets the start activity of the workflow.
        /// </summary>
        IWorkflowActivity Start
        {
            get;
        }

        /// <summary>
        /// Gets the current activity of the workflow.
        /// </summary>
        IWorkflowActivity Current
        {
            get;
        }

        /// <summary>
        /// Gets all possible transitions from the current activity.
        /// </summary>
        IWorkflowTransition[] CurrentTransitions
        {
            get;
        }

        /// <summary>
        /// Sets the workflow's start activity.
        /// </summary>
        /// <param name="start">Start activity.</param>
        void SetStart(IWorkflowActivity start);

        /// <summary>
        /// Sets the workflow's current activity.
        /// </summary>
        /// <param name="activity">New current activity.</param>
        void SetCurrent(IWorkflowActivity activity);

        /// <summary>
        /// Sets the workflow's current activity according to a selected transition <see cref="CurrentTransitions"/>.
        /// </summary>
        /// <param name="transition">Selected transition.</param>
        void SetCurrent(IWorkflowTransition transition);

        /// <summary>
        /// Adds a new transition to the workflow.
        /// </summary>
        /// <param name="transition">Transition to be added.</param>
        void AddTransition(IWorkflowTransition transition);

        /// <summary>
        /// Removes a transition from the workflow.
        /// </summary>
        /// <param name="transition">Transition to be removed.</param>
        void RemoveTransition(IWorkflowTransition transition);
    }
}
